<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>修改密码</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name=”apple-mobile-web-app-status-bar-style” content=”default”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”/>
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="format-detection" content="telephone=no"/>
    <link href="${s.base}/mobile/css/weui.min.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/jquery-weui.min.css" rel="stylesheet">
    <link href="${s.base}/mobile/css/weReward.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/weChat.css" rel="stylesheet"/>
    <script src="${s.base}/mobile/js/fontSize.js" type="text/javascript"></script>
</head>
<body>
<!-- 弹窗提示 -->
<div class="tc" style="display: none;">
    <div class="tc-out">
        <div class="tc-ctn">
            <div class="tc-top-pic"><img src="${s.base}/mobile/images/successtip.png"></div>
            <div class="tc-middle-txt"></div>
            <div class="tc-bot-btn clearfix">
                <div class="tc-button only-btn-blue">确定</div>
            </div>
        </div>
    </div>
</div>
<!-- 弹窗提示失败 -->
<div class="tc" style="display: none;">
    <div class="tc-out">
        <div class="tc-ctn">
            <div class="tc-top-pic"><img src="${s.base}/mobile/images/failure.png"></div>
            <div class="tc-middle-txt"></div>
            <div class="tc-bot-btn clearfix">
                <div class="tc-button only-btn-orange">确定</div>
            </div>
        </div>
    </div>
</div>
<form>
    <div class="content">
        <div class="div-line-bar">
            <div class="div-line-label">原密码</div>
            <div class="div-line-input">
                <input type="password" placeholder="请输入原密码" id="oldPassword" autocomplete="off">
            </div>
        </div>
        <div class="div-line-bar">
            <div class="div-line-label">新密码</div>
            <div class="div-line-input">
                <input type="password" placeholder="请输入新密码" id="newPassword" autocomplete="off">
            </div>
        </div>
        <div class="div-line-bar">
            <div class="div-line-label">确认新密码</div>
            <div class="div-line-input">
                <input type="password" placeholder="请再次输入新密码" id="password" autocomplete="off">
            </div>
        </div>
    </div>
    <div class="bot-tj-btn">提交</div>
</form>
</body>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-weui.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
<script>
    $(function () {
        $('.bot-tj-btn').bind('click', function () {
            var oldPassword = $('#oldPassword').val();
            if (isBlank(oldPassword)) {
                $.toast("请输入原密码", "text");
                return false;
            }
            var newPassword = $('#newPassword').val();
            if (isBlank(newPassword)) {
                $.toast("请输入新密码", "text");
                return false;
            }
            var password = $('#password').val();
            if (isBlank(password)) {
                $.toast("请再次输入新密码", "text");
                return false;
            }
            if (newPassword !== password) {
                $.toast("两次新密码输入不一致", "text");
                return false;
            }
            $.fn.doPost('/phone/reward/resetPassword', {token: '${token}', oldPassword: oldPassword, password: password}, function (result) {
                if (result.code === 0) {
                    $('.tc').eq(0).find(".tc-middle-txt")[0].innerHTML = result.msg;
                    $('.tc').eq(0).show();
                } else {
                    $('.tc').eq(1).find(".tc-middle-txt")[0].innerHTML = result.msg;
                    $('.tc').eq(1).show();
                }
            });
        });

        $(".tc-button").bind("click", function () {
            if ($(this).hasClass("only-btn-blue")) {
                $('.tc').eq(0).hide();
                window.location.href = "/phone/reward/personalIndex?token=${token}&applyId=${applyId}";
            } else if ($(this).hasClass("only-btn-orange")) {
                $('.tc').eq(1).hide();
            }
        });
    });
</script>
</html>